/*
J 2
The problem is so good, isn't it?
--  GD-00114  dengziyue  Xintang NO.3 Middle School
--  Writed it at 09:00
*/
#include<cstdio>
#include<algorithm>
using namespace std;
#define max_n 8000
int n;
int q;
int a[max_n+2];
struct S{
	int d,i;
}s[max_n+2];
int ans[max_n+2];
bool cmp(S a,S b){
	if(a.d^b.d)return a.d<b.d;
	return a.i<b.i;
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		s[i]=(S){a[i],i};
	}
	sort(s+1,s+n+1,cmp);
	for(int i=1;i<=n;++i)ans[s[i].i]=i;
	for(int i=1,op,x,v;i<=q;++i){
		scanf("%d",&op);
		if(op==1){
			scanf("%d%d",&x,&v);
			a[x]=v;
			for(int i=1;i<=n;++i)s[i]=(S){a[i],i};
			sort(s+1,s+n+1,cmp);
			for(int i=1;i<=n;++i)ans[s[i].i]=i;
		}
		else{
			scanf("%d",&x);
			printf("%d\n",ans[x]);
		}
	}
	return 0;
}

